package org.wisdom.ab.domain.company.entity;

import lombok.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.data.domain.DomainEvents;
import org.wisdom.data.jpa.entity.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import java.util.Collection;
import java.util.Collections;

/**
 * 公司
 *
 * @author 张智研
 * @date 2022/05/16 08:50
 **/
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@Slf4j
public class AbCompany extends BaseEntity {

    /** 公司编码 */
    @Column(nullable = false, unique = true, updatable = false)
    @Order(1)
    private String companyCode;

    /** 公司名称 */
    @Column(nullable = false)
    @Order(2)
    private String companyName;

    /** 公司英文名称 */
    @Order(3)
    private String companyNameEn;

    /** 公司描述 */
    @Order(4)
    private String companyDesc;

    /** 行业 */
    @Order(5)
    private String industry;

    @DomainEvents
    Collection<AbCompany> domainEvents() {
        log.info("事件->公司持久化{}", this);
        return Collections.singletonList(this);
    }
}
